home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.19970626-19970929 / 000004_news@newsmaster….columbia.edu _Tue Jul 1 12:51:23 1997.msg < prev    next >
Internet Message Format  |  2020-01-01  |  3KB

  1. Return-Path: <news@newsmaster.cc.columbia.edu>
  2. Received: from newsmaster.cc.columbia.edu (newsmaster.cc.columbia.edu [128.59.35.30])
  3.     by watsun.cc.columbia.edu (8.8.5/8.8.5) with ESMTP id MAA07934
  4.     for <kermit.misc@watsun.cc.columbia.edu>; Tue, 1 Jul 1997 12:51:23 -0400 (EDT)
  5. Received: (from news@localhost)
  6.     by newsmaster.cc.columbia.edu (8.8.5/8.8.5) id MAA22073
  7.     for kermit.misc@watsun; Tue, 1 Jul 1997 12:51:23 -0400 (EDT)
  8. Path: news.columbia.edu!watsun.cc.columbia.edu!jaltman
  9. From: jaltman@watsun.cc.columbia.edu (Jeffrey Altman)
  10. Newsgroups: comp.protocols.kermit.misc
  11. Subject: Re: syncronization client an server times
  12. Date: 1 Jul 1997 16:51:20 GMT
  13. Organization: Columbia University
  14. Lines: 59
  15. Message-ID: <5pbci8$lhn$1@newsmaster.cc.columbia.edu>
  16. References: <01bc8622$6a7cb8e0$9301dec3@roger.data.ee>
  17. NNTP-Posting-Host: watsun.cc.columbia.edu
  18. Xref: news.columbia.edu comp.protocols.kermit.misc:7248
  19.  
  20. In article <01bc8622$6a7cb8e0$9301dec3@roger.data.ee>,
  21. Anton Klevtsov <anton@data.ee> wrote:
  22. : hey all!
  23. : mayby someone knows how to sychronize times.
  24. : problem is following:
  25. : when I start my client (kermit for win95), first I have to receive time
  26. : from servet and set this time in client. so, how can i do that?
  27.  
  28. With Kermit-95 this is easy.  Kermit-95 supports host based time/date
  29. assignments within various terminal emulations.
  30.  
  31.  
  32.  
  33. /************************************************************************
  34.  
  35. This program queries the system clock and issues a VT series 
  36. time. 
  37.  
  38. VT CSI hr ; mm , p
  39.  
  40. The Wyse and Televideo sequences are as follows:
  41.  
  42. WY ESC c 8 hr mm
  43.  
  44. TVI ESC SP 1 ampm hr min
  45. ************************************************************************/
  46.  
  47.  
  48. #include <time.h>
  49. #include <stdio.h>
  50.  
  51. int main()
  52. {
  53.     struct tm *newtime;
  54.     time_t ltime;
  55.  
  56.     printf("Setting VT terminal clock ...\n"); 
  57.     time(<ime);
  58.     newtime = localtime(<ime);
  59.     printf("Time now: %d:%.2d:%.2d\n",newtime->tm_hour,         
  60.                newtime->tm_min,newtime->tm_sec);
  61.     if ( newtime->tm_sec != 0 ) {
  62.     sleep( 60 - newtime->tm_sec ) ;
  63.         newtime->tm_min += 1 ;
  64.     }
  65.     printf("%c[%d;%d,p",27,newtime->tm_hour,newtime->tm_min);
  66.     printf("Time set to %d:%.2d:00\n",newtime->tm_hour,newtime->tm_min);
  67.     return 0;
  68. }
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.     Jeffrey Altman * Sr.Software Designer * Kermit-95 for Win32 and OS/2
  76.                  The Kermit Project * Columbia University
  77.        612 West 115th St #716 * New York, NY * 10025 * (212) 854-1344
  78.     http://www.columbia.edu/kermit/k95.html * kermit-support@columbia.edu